//
//  storage.m
//  Bus
//
//  Created by How Charles on 12-2-5.
//  Copyright 2012 hust. All rights reserved.
//

#import "storage.h"


@implementation storage


+(NSString *)dataFilePathInDocument:(NSString *)fileName{
	
	 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
	 NSString *documentsDirectory = [paths objectAtIndex:0];
	 return [documentsDirectory stringByAppendingPathComponent:fileName];
	 
}


+(NSString *)dataFilePathInCache:(NSString *)fileName{
	
	NSString * path1=[NSHomeDirectory() stringByAppendingPathComponent:@"Library"];

	NSString * str=[path1 stringByAppendingPathComponent:@"/Caches/"];
	NSString * str2=[str stringByAppendingPathComponent:fileName];

	NSLog(@"dataFilePathInCache=%@",str2);
	
	return str2;
}


+(NSString *)dataFilePathInTmp:(NSString *)fileName{
	
	NSString * path1=[NSHomeDirectory() stringByAppendingPathComponent:@"Tmp/"];
	NSString * path2=[path1 stringByAppendingPathComponent:fileName];
	NSLog(@"dataFilePathInTmp=%@",path2);
	
	return path2;
}

+(NSString *)dataFilePathInResource:(NSString *)fileName{

	
	NSString * str=[[[NSBundle mainBundle] resourcePath] 
						stringByAppendingPathComponent:fileName]; 
	
	NSLog(@"dataFilePathInResource=%@",str);
	return str;
}


+(NSString *)dataFilePathCommon:(NSString *)fileName{
	
	return [storage dataFilePathInCache:fileName];
}

@end
